package com.XZDP.controller;


import com.XZDP.dto.Result;
import com.XZDP.service.IFollowService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/follow")
@Slf4j
public class FollowController {
    @Autowired
    private IFollowService followService;

    /**
     * 关注
     */
    @PutMapping("/{id}/true")
    public Result Concern(@PathVariable("id") Long id) {
        log.info("关注用户ID{}", id);
        return followService.Concern(id);
    }


    /**
     * 取关
     */
    @PutMapping("/{id}/false")
    public Result Close(@PathVariable("id") Long id) {
        log.info("取关用户ID{}", id);
        return followService.Close(id);
    }

    /**
     * 查看关注状态
     */
    @GetMapping("/or/not/{id}")
    public Result ISFollow(@PathVariable("id") Long id) {
        Boolean b = followService.isFollow(id);
        return Result.ok(b);
    }


    /**
     * 共同关注
     */
    @GetMapping("/common/{id}")
    public Result CommonFollow(@PathVariable("id") Long id) {
        return followService.CommonFollow(id);
    }
}
